package com.huanghao.Service.impl;

import java.sql.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.huanghao.Service.CommodService;
import com.huanghao.Service.OrderService;
import com.huanghao.mapper.OrderMapper;
import com.huanghao.pojo.Commod;
import com.huanghao.pojo.Order;
import com.huanghao.pojo.PageBean;

@Service
public class OrderServertImpl implements OrderService{

    @Autowired
    private OrderMapper orderMapper;

    //查询
	@Override
	public PageBean page(Integer page, Integer pageSize, String name, String user) {
        PageHelper.startPage(page,pageSize);
        List<Order> orderList = orderMapper.page(name,user);
        Page<Order> p = (Page<Order>) orderList;
        PageBean pageBean = new PageBean(p.getTotal(),p.getResult());
        return pageBean;
	}

    //根据ID查询
    @Override
    public Order getById(Integer id) {
        return orderMapper.getById(id);
    }
    
    //删除
	@Override
	public void delete(List<Integer> oNumber) {
        orderMapper.deleteByid(oNumber);
	}
	
		// 增加
	@Override
	public void add(Order order) {
		orderMapper.add(order);
	}

	//更新
	@Override
	public void update(Order order) {
		orderMapper.update(order);
	}
    
}
